package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.ProductionBomMaterialMapper;
import com.ruoyi.factorydata.domain.ProductionBomMaterial;
import com.ruoyi.factorydata.service.IProductionBomMaterialService;

/**
 * 产品bom物料明细Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-20
 */
@Service
public class ProductionBomMaterialServiceImpl extends ServiceImpl<ProductionBomMaterialMapper, ProductionBomMaterial> implements IProductionBomMaterialService {
    @Autowired
    private ProductionBomMaterialMapper productionBomMaterialMapper;

    /**
     * 查询产品bom物料明细
     *
     * @param id 产品bom物料明细主键
     * @return 产品bom物料明细
     */
    @Override
    public ProductionBomMaterial selectProductionBomMaterialById(Long id) {
        return productionBomMaterialMapper.selectProductionBomMaterialById(id);
    }

    /**
     * 查询产品bom物料明细列表
     *
     * @param productionBomMaterial 产品bom物料明细
     * @return 产品bom物料明细
     */
    @Override
    public List<ProductionBomMaterial> selectProductionBomMaterialList(ProductionBomMaterial productionBomMaterial) {
        return productionBomMaterialMapper.selectProductionBomMaterialList(productionBomMaterial);
    }

    /**
     * 新增产品bom物料明细
     *
     * @param productionBomMaterial 产品bom物料明细
     * @return 结果
     */
    @Override
    public int insertProductionBomMaterial(ProductionBomMaterial productionBomMaterial) {
                productionBomMaterial.setCreateTime(DateUtils.getNowDate());
            return productionBomMaterialMapper.insertProductionBomMaterial(productionBomMaterial);
    }

    /**
     * 修改产品bom物料明细
     *
     * @param productionBomMaterial 产品bom物料明细
     * @return 结果
     */
    @Override
    public int updateProductionBomMaterial(ProductionBomMaterial productionBomMaterial) {
                productionBomMaterial.setUpdateTime(DateUtils.getNowDate());
        return productionBomMaterialMapper.updateProductionBomMaterial(productionBomMaterial);
    }

    /**
     * 批量删除产品bom物料明细
     *
     * @param ids 需要删除的产品bom物料明细主键
     * @return 结果
     */
    @Override
    public int deleteProductionBomMaterialByIds(Long[] ids) {
        return productionBomMaterialMapper.deleteProductionBomMaterialByIds(ids);
    }

    /**
     * 删除产品bom物料明细信息
     *
     * @param id 产品bom物料明细主键
     * @return 结果
     */
    @Override
    public int deleteProductionBomMaterialById(Long id) {
        return productionBomMaterialMapper.deleteProductionBomMaterialById(id);
    }
}